import Vue from 'vue'

const appendText = Vue.directive('appendText', {
    bind() {
        console.log('bind');
    },
    inserted(el, binding) {
        el.appendChild(document.createTextNode(binding.value));
        console.log('inserted')
    },
    update() {
        console.log('update')
    },
    componentUpdated(el, binding) {
        el.removeChild(el.childNodes[el.childNodes - 1]);
        el.appendChild(document.createTextNode(binding.value));
        console.log('componentUpdated')
    },
    unbind() {
        console.log('unbind')
    }
})

export default appendText